<?php

/*
*###########################################################################################################################*
#															    															#
#															    															#
#    **  ** ****** ** **  **  ****** ** ***   ** ***   ****** ** **  **  ** **  ** ** **  **    ****   ** **  **  ******    #
#    **  ** ****** ********** ****** *******  *******  ****** ********** ** **  ** **********  ******  ********** ******    #
#    **  ** **  ** **  **  ** **     ***   ** **    ** **     **  **  **    **  ** **  **  ** ***   ** **  **  ** **        #
#    ****** **  ** **  **  ** ****** **   *** **   *** ****** **  **  ** ** **  ** **  **  ** **       **  **  ** ******    #
#    ****** **  ** **  **  ** ****** *******  *******  ****** **  **  ** ** **  ** **  **  ** **       **  **  ** ******    #
#    **  ** **  ** **  **  ** **     *****    ******   **     **  **  ** ** **  ** **  **  ** ***   ** **  **  **     **    #
#    **  ** ****** **  **  ** ****** **       **  ***  ****** **  **  ** ** ****** **  **  **  ******  **  **  ** ******    #
#    **  ** ****** **  **  ** ****** **       **   *** ****** **  **  ** **  ** ** **  **  **   ****   **  **  ** ******    #
#															    															#
#															    															#
#															    															#
#    2010 - 2011 © HomePremiumCMS made by HomePemium as PremiumEye & Security by HomePremium and Merijnz		    		#
#															    															#
#    Powered by PhoenixPHP 3.7.1 (build 138000)										    									#
#															    															#
#															    															#
#															    															#
*###########################################################################################################################*
*/

header('Content-Type: text/html; charset=iso-8859-1'); 
define('SEP', DIRECTORY_SEPARATOR);
$dir = str_replace('register'.SEP, '', dirname(__FILE__).SEP);
$dir = str_replace('functions'.SEP, '', $dir);
$dir = str_replace('housekeeping'.SEP, '', $dir);
define('DIR', $dir);
define('DOCUMENT_ROOT', DIR.SEP);
define('INCLUDES', DIR.'inc'.SEP);
define('WWW', 'http://'.$_SERVER['SERVER_NAME']);

session_start();

require_once DOCUMENT_ROOT.'inc/config.php';

$connect = mysql_connect($dbhost, $dbusername, $dbpassword) or die("

<div style='background-color: #E2E2E2;border: 1px solid #E2E2E2;border-radius: 4px;padding: 10px 10px 10px 10px;width: 700px;margin: auto;color: #383838;font-family: verdana;font-size:12px;'>
Could not connect to server, error: ".mysql_error()."
<div style='border-top: 1px solid #A8A8A8;margin: 10px 0px 10px 0px;'></div>
In the folder <b>'inc'</b> is a file named <b>'config'</b>. Your account name or password isn't correct.
</div>

");
mysql_select_db($dbname, $connect) or die("

<div style='background-color: #E2E2E2;border: 1px solid #E2E2E2;border-radius: 4px;padding: 10px 10px 10px 10px;width: 700px;margin: auto;color: #383838;font-family: verdana;font-size:12px;'>
Could not connect to database, error: ".mysql_error()."
<div style='border-top: 1px solid #A8A8A8;margin: 10px 0px 10px 0px;'></div>
In the folder <b>'inc'</b> is a file named <b>'config'</b>. By dbname isn't the database name correct.
</div>

");

require_once INCLUDES."class.core.php";
require_once INCLUDES."class.users.php";
require_once INCLUDES."class.antisulake.php";

$core = new Core();
$users = new Users();
$antiSulake = new AntiSulake();

foreach($_POST as $var => $value) { $_POST[$var] = $core->EscapeString($value); }
foreach($_GET as $var => $value) { $_GET[$var] = $core->EscapeString($value); }

$antiSulake;

require_once DOCUMENT_ROOT.'inc/lang/'.$language.'.php';

define('MAINTENANCE', $core->Maintenance());

if(USERNAME_REQUIRED == TRUE && !isset($_SESSION["username"]))
	header("Location: ".WWW."/me.php");
	
if(ACCOUNT_REQUIRED == TRUE && !isset($_SESSION["account"]))
	header("Location: ".WWW."/index.php");

$sitename = $core->CmsSetting('cms_name');

if(isset($_SESSION["username"]))
{
	$username = $core->EscapeString($_SESSION['username']);
	
	if($users->CheckBan($username))
		header($users->BanInfo($username));
}

if(MAINTENANCE && !$users->UserPermission('hk_login', $username) && !defined('MAINTENANCE_PAGE'))
	header("Location: ".WWW."/maintenance.php");
	
	
?>
